import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state: {
        cachePages: ['LayoutIndex']
    },
    mutations: {
        //添加缓存页面
        addCachePage(state, pagename) {
            if (!state.cachePages.includes(pagename)) {
                state.cachePages.push(pagename)
            }
        },
        //移除缓存页面
        removeCachePage(state, pagename) {
            const index = state.cachePages.indexOf(pagename)
            if (index !== -1) {
                state.cachePages.splice(index, 1)
            }
        }
    },
    actions: {},
    modules: {}
})